package reflect;

import java.lang.reflect.Method;

public class ReflectDemo5 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.Person");
        Object o = cls.newInstance();

        Method say = cls.getMethod("say", String.class);
        say.invoke(o,"我真的爱你");

        Method say1 = cls.getMethod("say", String.class, int.class);
        say1.invoke(o,"我爱你",10);
    }
}
